﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Zwms.Client.InfoSys;
using Zwms.Client.CommonUI;

namespace Zwms.Client.ManageWms
{
    public partial class TsfSubmitForm : BaseForm
    {
        private string _tsfDate;
        private string _operatorCode;
        private string _operatorName;
        public string TsfDate { get { return _tsfDate; } }
        public string OperatorCode { get { return _operatorCode; } }
        public string OperatorName { get { return _operatorName; } }
       
        public TsfSubmitForm()
        {
            InitializeComponent();
           ServiceReferenceZwms.ServiceZwmsClient client = new ServiceReferenceZwms.ServiceZwmsClient();
            dpuTsfDate.SetDate(client.GetCurrentSystemTime());
        }

        private void tbsOperator_SelectButtonClick(object sender, EventArgs e)
        {
            SysAccountWnd uc = new SysAccountWnd();
            CommonUI.ContainerForm window = new CommonUI.ContainerForm(uc, "选择操作员");
            uc.SetQueryState();
            if (window.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                tbsOperator.SetTextBoxContent(uc.SelectedRecord.UserName);
                tbsOperator.Tag = uc.SelectedRecord.Id;
            }
        }

        private void btnConfirm_Click(object sender, EventArgs e)
        {
            bool b = true;
            if (string.IsNullOrWhiteSpace(this.dpuTsfDate.SelectDateTime))
            {
                this.dpuTsfDate.SetTextBGColor(Color.Yellow);
                b = false;
            }
            if (string.IsNullOrWhiteSpace(this.tbsOperator.GetTextBoxContent()))
            {
                this.tbsOperator.SetTextBGColor(Color.Yellow);
                b = false;
            }
            if (b)
            {
                this._tsfDate = this.dpuTsfDate.SelectDateTime;
                this._operatorName = this.tbsOperator.GetTextBoxContent();
                this._operatorCode = this.tbsOperator.Tag.ToString();
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
            }
            else
            {
                return;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
        }
    }

    
}
